<!DOCTYPE html>
<meta charset="utf-8" />
<title>FormData: Upload files named using controls (tentative)</title>
<!--
    NOTE: This test is tentative because encoding for filename
    control characters is not yet standardized.
  -->
<link
  rel="help"
  href="https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#multipart-form-data"
/>
<link
  rel="help"
  href="https://html.spec.whatwg.org/multipage/dnd.html#datatransferitemlist"
/>
<link rel="help" href="https://w3c.github.io/FileAPI/#file-constructor" />
<link
  rel="author"
  title="Benjamin C. Wiley Sittler"
  href="mailto:bsittler@chromium.org"
/>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../support/send-file-formdata-helper.js"></script>
<script>
  "use strict";

  formDataPostFileUploadTest({
    fileNameSource: "ASCII",
    fileBaseName: "file-for-upload-in-form-NUL-[\0].txt",
  });

  formDataPostFileUploadTest({
    fileNameSource: "ASCII",
    fileBaseName: "file-for-upload-in-form-BS-[\b].txt",
  });

  formDataPostFileUploadTest({
    fileNameSource: "ASCII",
    fileBaseName: "file-for-upload-in-form-VT-[\v].txt",
  });

  // These have characters that undergo processing in name=,
  // filename=, and/or value; formDataPostFileUploadTest postprocesses
  // expectedEncodedBaseName for these internally.

  formDataPostFileUploadTest({
    fileNameSource: "ASCII",
    fileBaseName: "file-for-upload-in-form-LF-[\n].txt",
  });

  formDataPostFileUploadTest({
    fileNameSource: "ASCII",
    fileBaseName: "file-for-upload-in-form-LF-CR-[\n\r].txt",
  });

  formDataPostFileUploadTest({
    fileNameSource: "ASCII",
    fileBaseName: "file-for-upload-in-form-CR-[\r].txt",
  });

  formDataPostFileUploadTest({
    fileNameSource: "ASCII",
    fileBaseName: "file-for-upload-in-form-CR-LF-[\r\n].txt",
  });

  formDataPostFileUploadTest({
    fileNameSource: "ASCII",
    fileBaseName: "file-for-upload-in-form-HT-[\t].txt",
  });

  formDataPostFileUploadTest({
    fileNameSource: "ASCII",
    fileBaseName: "file-for-upload-in-form-FF-[\f].txt",
  });

  formDataPostFileUploadTest({
    fileNameSource: "ASCII",
    fileBaseName: "file-for-upload-in-form-DEL-[\x7F].txt",
  });

  // The rest should be passed through unmodified:

  formDataPostFileUploadTest({
    fileNameSource: "ASCII",
    fileBaseName: "file-for-upload-in-form-ESC-[\x1B].txt",
  });

  formDataPostFileUploadTest({
    fileNameSource: "ASCII",
    fileBaseName: "file-for-upload-in-form-SPACE-[ ].txt",
  });
</script>
